<?php

/**
 * author : Tran Minh Toan
 */

class Application_Form_User extends Zend_Form{
    
    public function init(){
        $this->setName('User');
        //$this->setMethod('post');
        //$product = new Application_Form_Product();
        $user_id = new Zend_Form_Element_Hidden('user_id');
        
      
        $user_account = new Zend_Form_Element_Text('user_account');
            $user_account->setLabel('Tên tài khoản :')
                    ->setRequired(TRUE)
                    ->addValidator('NotEmpty');
            
        $user_password = new Zend_Form_Element_Password('user_password');
            $user_password->setLabel('Mật khẩu :')
                    ->setRequired(true)
                    ->addValidator('NotEmpty');
        
        $user_fullname = new Zend_Form_Element_Text('user_fullname');
            $user_fullname->setLabel('Họ và tên :')
                    ->setRequired(TRUE)
                    ->addValidator('NotEmpty');
        
        $user_birthday = new Zend_Form_Element_Text('user_birthday');
            $user_birthday->setLabel('Ngày sinh :')
                    ->setRequired(true)
                    ->addValidator('NotEmpty');
            
        $user_address = new Zend_Form_Element_Textarea('user_address');
            $user_address->setLabel('Địa chỉ :')
                    ->setRequired(true)
                    ->addValidator('NotEmpty')
                    ->addFilters(array('StripTags', 'StringTrim'));
        
        $user_idcard = new Zend_Form_Element_Text('user_idcard');
            $user_idcard->setLabel('ID Card :')
                    ->setRequired(true)
                    ->addValidator('NotEmpty')
                    ->addFilters(array('StripTags', 'StringTrim', 'Int')); 
        
           
        $captcha = new Zend_Form_Element_Captcha(
                'captcha', // This is the name of the input field
                array('label' => 'Vui lòng điền nhập đoạn mã sau : ',
                'captcha' => array( // Here comes the magic...
                // First the type...
                'captcha' => 'Image',
              
                    
                // Length of the word...
                'wordLen' => 6,
                // Captcha timeout, 5 mins
                'timeout' => 300,
                // What font to use...
                'font' => APPLICATION_PATH.'/../public/media/images/captcha/fonts/arial.ttf',
                // Where to put the image
                'imgDir' => APPLICATION_PATH . '/../public/media/images/captcha/img',
                // URL to the images
                // This was bogus, here's how it should be... Sorry again :S
                
                'imgUrl' => URLCAPTCHA,
        )));
        //$g=new Zend_form
            //$captcha->setLabel('Vui lòng điền nhập đoạn mã sau : ');
        $btn_submit = new Zend_Form_Element_Submit('submit');
        $btn_submit->setAttrib('id', 'submit');
        $btn_submit->setlabel('Đồng ý');

        $btn_cancel = new Zend_Form_Element_Submit('cancel');
        $btn_cancel->setAttrib('id', 'cancel');
        $btn_cancel->setLabel('Hủy bỏ');
        
        $this->addElements(array($user_account, $user_password, $user_fullname, $user_birthday, 
            $user_address, $user_idcard, $captcha, $user_id, $btn_submit, $btn_cancel));
           
    }
}

?>
